AUX_SOURCE_DIRECTORY(. CLIENT_SRC)
ADD_EXECUTABLE(client ${CLIENT_SRC})
ADD_DEPENDENCIES(client mir2x_3rds)

TARGET_INCLUDE_DIRECTORIES(client PRIVATE ${MIR2X_COMMON_SOURCE_DIR})

TARGET_LINK_LIBRARIES(client ${G3LOG_LIBRARIES}   )
TARGET_LINK_LIBRARIES(client ${TINYXML2_LIBRARIES})
TARGET_LINK_LIBRARIES(client ${CMAKE_DL_LIBS}     )
TARGET_LINK_LIBRARIES(client common               )
TARGET_LINK_LIBRARIES(client SDL2_ttf             )
TARGET_LINK_LIBRARIES(client SDL2_gfx             )
TARGET_LINK_LIBRARIES(client SDL2_image           )
TARGET_LINK_LIBRARIES(client ${LUA_LIBRARIES}     )
TARGET_LINK_LIBRARIES(client ${LZ4_LIBRARIES}     )
TARGET_LINK_LIBRARIES(client ${ZSTD_LIBRARIES}    )
TARGET_LINK_LIBRARIES(client Threads::Threads     )

IF(WIN32)
    TARGET_LINK_LIBRARIES(client SDL2::SDL2main SDL2::SDL2-static)
    TARGET_LINK_LIBRARIES(client ${FREETYPE_LIBRARIES})
ELSE()
    TARGET_LINK_LIBRARIES(client ${SDL2_LIBRARIES})
ENDIF()

INSTALL(TARGETS client DESTINATION client)
INSTALL(DIRECTORY ${CMAKE_SOURCE_DIR}/client/bin/res DESTINATION client)
INSTALL(FILES ${CMAKE_SOURCE_DIR}/client/bin/configuration.xml DESTINATION client)
